import 'package:json_annotation/json_annotation.dart';
import 'package:gzmall_app/model/coupon.dart';
import 'package:gzmall_app/model/product.dart';

part 'coupon_item.g.dart';

@JsonSerializable()
class CouponItem extends Object {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'state')
  String state;

  @JsonKey(name: 'had')
  bool had;

  @JsonKey(name: 'coupon')
  Coupon coupon;

  @JsonKey(name: 'spu')
  Product spu;

  CouponItem(
    this.id,
    this.state,
    this.coupon,
    this.spu,
    this.had,
  );

  factory CouponItem.fromJson(Map<String, dynamic> srcJson) =>
      _$CouponItemFromJson(srcJson);
}
